<!DOCTYPE html>
<html lang="en">
<head>
	<meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1">
	<meta charset="UTF-8">
	<title>等待确认</title>
	<meta name="description" content="">
	<meta name="keywords" content="">
	<meta name="viewport" content="initial-scale=1, width=device-width, maximum-scale=1, user-scalable=no">
	<meta name="format-detection" content="telephone=no,email=no,adress=no" />
	<meta name="apple-mobile-web-app-capable" content="yes" />  
	<meta name="apple-mobile-web-app-status-bar-style" content="black">
	<link rel="stylesheet" href="{THEME_PATH}styles/swiper.min.css">
	<link rel="stylesheet" href="{THEME_PATH}styles/reset.css">
	<link rel="stylesheet" href="{THEME_PATH}styles/common.css">
	<link rel="stylesheet" href="{THEME_PATH}styles/style.css">	
</head>
<body>
	<!-- S header -->
	<header>
		<a href="<?php echo U('index?type=1'); ?>" class="headerL iconfont">&#xe69f;</a>
		<h1>交易详情</h1>
	</header>
	<!-- E header -->

	<!-- S 交易状态 -->
	<dl class="my-deal-condition">
		<dt><img src="{THEME_PATH}images/icon-deal1.png" alt="" width="21">等待确认</dt>
		<!-- <dd><img src="{THEME_PATH}images/icon-deal2.png" alt="">02:59:28</dd> -->
		<dd id="time"></dd>
	</dl>
	<!-- E 交易状态 -->

	<!-- S 对方信息 -->
	<h2 class="my_deal_h2">对方信息</h2>
	<dl class="my_deal_user">
		<dt><img src="<?php echo $info['photo'] ? $info['photo'] : THEME_PATH.'images/user-my.png';?>" alt="" width="50" class="user_photo"></dt>
		<dd><?php echo $info['real_name'];?></dd>
	</dl>
	<ul class="my_deal_msg_items">
		<li class="flex flex-pack-justify">
			<div>真实姓名</div>
			<div class="asidR"><?php echo $info['real_name'];?></div>
		</li>		
		<li class="flex flex-pack-justify">
			<div>电话</div>
			<div class="asidR"><?php echo $info['username']; ?> <img src="{THEME_PATH}images/icon-deal3.png" alt="" width="12" class="icon-deal3"></div>
		</li>
		<li class="flex flex-pack-justify">
			<div>微信</div>
			<div class="asidR"><?php echo $info['wx_account']; ?> <img src="{THEME_PATH}images/icon-deal4.png" alt="" width="12.5" class="icon-deal4"></div>
		</li>
		<li class="flex flex-pack-justify">
			<div>支付宝</div>
			<div class="asidR"><?php echo $info['alipay_account']; ?><img src="{THEME_PATH}images/icon-deal4.png" alt="" width="12.5" class="icon-deal4"></div>
		</li>
	</ul>
	<!-- E 对方信息 -->
	<!-- S 订单信息 -->
	<h2 class="my_deal_h2">订单信息</h2>
	<ul class="my_deal_msg_items">
		<li class="flex flex-pack-justify">
			<div>数量</div>
			<div class="asidR"><?php echo $info['number']; ?> GF</div>
		</li>
		<li class="flex flex-pack-justify">
			<div>单价</div>
			<div class="asidR"><?php echo $info['price']; ?> CNY</div>
		</li>
		<li class="flex flex-pack-justify">
			<div>总价</div>
			<div class="asidR"><?php echo $info['all_price']; ?> CNY</div>
		</li>
		<li class="flex flex-pack-justify">
			<div>时间</div>
			<div class="asidR"><?php echo $info['time'];?></div>
		</li>
	</ul>
	<!-- E 订单信息 -->
	<!-- S 转账信息 -->
	<h2 class="my_deal_h2">转账信息</h2>
	<ul class="transfer-information">
		<li class="flex flex-pack-justify">
			<div>转账</div>
			<div><?php echo $transfer_info['status'] == 1 ?'待确认' : '成功'; ?></div>
		</li>
		<li class="flex flex-pack-justify">
			<div>收款方</div>
			<div><?php echo $info['username']; ?></div>
		</li>
		<li class="flex flex-pack-justify">
			<div>转账时间</div>
			<div><?php echo $transfer_info['add_time'];?></div>
		</li>
		<li class="flex flex-pack-justify">
			<div>转账单号</div>
			<div><?php echo $transfer_info['order_number'];?></div>
		</li>
		<li class="flex flex-pack-justify">
			<div>备注</div>
			<div><?php echo $transfer_info['remarks']; ?></div>
		</li>
	</ul>
	<!-- E 转账信息 -->

	<ul class="deal-btns-wrap flex flex-pack-justify">
		<li><a href="javascript:;" onclick="complainBtn()">举报</a></li>
		<li><a href="javascript:;" id="sure">确认收款</a></li>
	</ul>

	<div class="popup_shade"></div>
	<!-- S 举报 -->
	<div class="complain_popUp">
		<h2 class="title alignC">请输入举报理由</h2>
		<textarea name="" class="text" placeholder="请输入举报理由" id="text"></textarea>
		<a href="javascript:;" class="btn jubao">提交</a>
	</div>
	<!-- E 举报 -->

	<script src="{THEME_PATH}js/jquery-1.8.3.min.js"></script>
	<script src="{THEME_PATH}js/swiper.min.js"></script>
	<script src="/statics/js/layer/layer.js"></script>
	<script type="text/javascript">
        $(function(){
            countDown(<?php echo $order_info['time']?>);
        })
    </script>
	<script>

		//举报
		function complainBtn(){
			$(".popup_shade,.complain_popUp").show();
		}
		



		$('.jubao').click(function(){
			
			var buy_content = $('#text').val();
			// console.log(buy_content);
			if(!buy_content){
				layer.msg('请输入举报内容');
				setTimeout(function(){
							location.reload();
						},1000);
				return false;
			}
			var type ='sell';
			var id = <?php echo $order_info['id'];?>;
			$.ajax({
				url:"/index.php/?m=user&c=order&a=jubao",
				type:'post',
				data:{sell_content:buy_content,id:id,type:type},
				dataType:'json',
				success:function(data){
					
					if(data.status ==0){
						// console.log(data.info);
						// return;
						layer.msg(data.info);
						setTimeout(function(){
							location.reload();
						},1000);
					}else{
		
						// $(".popup_shade,#payment_popUp").hide();
						// $(".popup_shade,#success").show();
						layer.msg(data.info);

						setTimeout(function(){
						// location.href = "/index.php?m=user&c=trade&a=index";
						window.location.reload();
						},1000);
				
						// layer.close(index);
						return;
					}
				}
			});
			layer.close();
	})

		$('#sure').click(function(){
			layer.confirm('确定已经收到款了吗?', {btn: ['是','否'] }, function(index){
				var id = <?php echo $order_info['id'];?>;
				$.ajax({
					url:"/index.php/?m=user&c=order&a=sure_get_money",
					type:'post',
					data:{id:id},
					dataType:'json',
					success:function(data){
						// console.log(data);
						if(data.status ==0){
							layer.msg(data.info);
						}else{
							layer.msg(data.info);
							setTimeout(function(){  //使用  setTimeout（）方法设定定时2000毫秒
								// window.location.reload();//页面刷新
								location.href = "/index.php?m=user&c=order&a=order_detail&id="+id;
							},2000);
						}
					}
				})
				layer.close(index);
			})
		})
		function countDown(times){
			console.log(times);
			var timer=null;
			timer=setInterval(function(){
				var day=0,
				hour=0,
				minute=0,
				second=0;//时间默认值
				if(times > 0){
				// day = Math.floor(times / (60 * 60 * 24));
				hour = Math.floor(times / (60 * 60)) - (day * 24);
				minute = Math.floor(times / 60) - (day * 24 * 60) - (hour * 60);
				second = Math.floor(times) - (day * 24 * 60 * 60) - (hour * 60 * 60) - (minute * 60);
				}
				// if (day <= 9) day = '0' + day;
				if (hour <= 9) hour = '0' + hour;
				if (minute <= 9) minute = '0' + minute;
				if (second <= 9) second = '0' + second;
				$("#time").html("倒计时&nbsp;"+hour+":"+minute+":"+second);
				// console.log(hour+":"+minute+":"+second);
				times--;
			},1000);
			if(times<=0){
				// $("#time").html("倒计时&nbsp;00:00:00");
				clearInterval(timer);
			}
		}

	</script>
</body>
</html>